GROUP BY and ORDER BY supports arrays in Database class
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 12 May 2012 22:06:48 +0000 (00:06 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 12 May 2012 22:06:48 +0000 (00:06 +0200)
Change-Id: Ib431b07ffa2ce6843e21536de2ff19c648e0a595

13 files changed:
includes/Export.php
includes/Pager.php
includes/QueryPage.php
includes/specials/SpecialActiveusers.php
includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialFewestrevisions.php
includes/specials/SpecialListfiles.php
includes/specials/SpecialMostcategories.php
includes/specials/SpecialMostlinked.php
includes/specials/SpecialMostlinkedtemplates.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialWantedpages.php
includes/specials/SpecialWantedtemplates.php

index ea6fd94..c201c97 100644 (file)
@@ -338,7 +338,7 @@ class WikiExporter {
                        } elseif ( $this->history & WikiExporter::RANGE ) {
                                # Dump of revisions within a specified range
                                $join['revision'] = array( 'INNER JOIN', 'page_id=rev_page' );
-                               $opts['ORDER BY'] = 'rev_page ASC, rev_id ASC';
+                               $opts['ORDER BY'] = array( 'rev_page ASC', 'rev_id ASC' );
                        } else {
                                # Uknown history specification parameter?
                                wfProfileOut( __METHOD__ );
index f0f1876..438a99a 100644 (file)
@@ -313,14 +313,14 @@ abstract class IndexPager extends ContextSource implements Pager {
                $join_conds = isset( $info['join_conds'] ) ? $info['join_conds'] : array();
                $sortColumns = array_merge( array( $this->mIndexField ), $this->mExtraSortFields );
                if ( $descending ) {
-                       $options['ORDER BY'] = implode( ',', $sortColumns );
+                       $options['ORDER BY'] = $sortColumns;
                        $operator = '>';
                } else {
                        $orderBy = array();
                        foreach ( $sortColumns as $col ) {
                                $orderBy[] = $col . ' DESC';
                        }
-                       $options['ORDER BY'] = implode( ',', $orderBy );
+                       $options['ORDER BY'] = $orderBy;
                        $operator = '<';
                }
                if ( $offset != '' ) {
index f28aeee..1c42b1c 100644 (file)
@@ -376,7 +376,7 @@ abstract class QueryPage extends SpecialPage {
                        $options = isset( $query['options'] ) ? (array)$query['options'] : array();
                        $join_conds = isset( $query['join_conds'] ) ? (array)$query['join_conds'] : array();
                        if ( count( $order ) ) {
-                               $options['ORDER BY'] = implode( ', ', $order );
+                               $options['ORDER BY'] = $order;
                        }
                        if ( $limit !== false ) {
                                $options['LIMIT'] = intval( $limit );
index 8f4a943..06a4694 100644 (file)
@@ -106,7 +106,7 @@ class ActiveUsersPager extends UsersPager {
                                'MAX(ipb_user) AS blocked'
                        ),
                        'options' => array(
-                               'GROUP BY' => 'rc_user_text, user_id',
+                               'GROUP BY' => array( 'rc_user_text', 'user_id' ),
                                'USE INDEX' => array( 'recentchanges' => 'rc_user_text' )
                        ),
                        'join_conds' => array(
index b46ef0e..b7f1e61 100644 (file)
@@ -277,7 +277,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        array( 'wl_namespace',  'wl_title' ),
                        array( 'wl_user' => $this->getUser()->getId() ),
                        __METHOD__,
-                       array( 'ORDER BY' => 'wl_namespace, wl_title' )
+                       array( 'ORDER BY' => array( 'wl_namespace', 'wl_title' ) )
                );
 
                $lb = new LinkBatch();
index 7677095..5610cc2 100644 (file)
@@ -56,7 +56,7 @@ class FewestrevisionsPage extends QueryPage {
                        // useful to remove this. People _do_ create pages
                        // and never revise them, they aren't necessarily
                        // redirects.
-                       'GROUP BY' => 'page_namespace, page_title, page_is_redirect' )
+                       'GROUP BY' => array( 'page_namespace', 'page_title', 'page_is_redirect' ) )
                );
        }
 
index fd48cb0..abd83ac 100644 (file)
@@ -156,9 +156,8 @@ class ImageListPager extends TablePager {
                        if( $dbr->implicitGroupby() ) {
                                $options = array( 'GROUP BY' => 'img_name' );
                        } else {
-                               $columnlist = implode( ',',
-                                       preg_grep( '/^img/', array_keys( $this->getFieldNames() ) ) );
-                               $options = array( 'GROUP BY' => "img_user, $columnlist" );
+                               $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) );
+                               $options = array( 'GROUP BY' => array_merge( array( 'img_user' ), $columnlist ) );
                        }
                        $join_conds = array( 'oldimage' => array( 'LEFT JOIN', 'oi_name = img_name' ) );
                }
index 98b7367..5174567 100644 (file)
@@ -46,7 +46,7 @@ class MostcategoriesPage extends QueryPage {
                                        'COUNT(*) AS value' ),
                        'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces() ),
                        'options' => array ( 'HAVING' => 'COUNT(*) > 1',
-                               'GROUP BY' => 'page_namespace, page_title' ),
+                               'GROUP BY' => array( 'page_namespace', 'page_title' ) ),
                        'join_conds' => array ( 'page' => array ( 'LEFT JOIN',
                                        'page_id = cl_from' ) )
                );
index a16f087..47e8fbf 100644 (file)
@@ -47,8 +47,8 @@ class MostlinkedPage extends QueryPage {
                                        'COUNT(*) AS value',
                                        'page_namespace' ),
                        'options' => array ( 'HAVING' => 'COUNT(*) > 1',
-                               'GROUP BY' => 'pl_namespace, pl_title, '.
-                                               'page_namespace' ),
+                               'GROUP BY' => array( 'pl_namespace', 'pl_title',
+                                               'page_namespace' ) ),
                        'join_conds' => array ( 'page' => array ( 'LEFT JOIN',
                                        array ( 'page_namespace = pl_namespace',
                                                'page_title = pl_title' ) ) )
index 72dc15b..370ba68 100644 (file)
@@ -68,7 +68,7 @@ class MostlinkedTemplatesPage extends QueryPage {
                                        'tl_title AS title',
                                        'COUNT(*) AS value' ),
                        'conds' => array ( 'tl_namespace' => NS_TEMPLATE ),
-                       'options' => array( 'GROUP BY' => 'tl_namespace, tl_title' )
+                       'options' => array( 'GROUP BY' => array( 'tl_namespace', 'tl_title' ) )
                );
        }
 
index d1bb3f0..654d5b7 100644 (file)
@@ -97,8 +97,8 @@ class PageArchive {
                                $condition,
                                __METHOD__,
                                array(
-                                       'GROUP BY' => 'ar_namespace,ar_title',
-                                       'ORDER BY' => 'ar_namespace,ar_title',
+                                       'GROUP BY' => array( 'ar_namespace', 'ar_title' ),
+                                       'ORDER BY' => array( 'ar_namespace', 'ar_title' ),
                                        'LIMIT' => 100,
                                )
                        )
index 4624b35..9f5d52d 100644 (file)
@@ -72,7 +72,7 @@ class WantedPagesPage extends WantedQueryPage {
                        ),
                        'options' => array(
                                'HAVING' => "COUNT(*) > $count",
-                               'GROUP BY' => 'pl_namespace, pl_title'
+                               'GROUP BY' => array( 'pl_namespace', 'pl_title' )
                        ),
                        'join_conds' => array(
                                'pg1' => array(
index ab9d604..2b4364b 100644 (file)
@@ -46,7 +46,7 @@ class WantedTemplatesPage extends WantedQueryPage {
                        'conds' => array ( 'page_title IS NULL',
                                        'tl_namespace' => NS_TEMPLATE ),
                        'options' => array (
-                               'GROUP BY' => 'tl_namespace, tl_title' ),
+                               'GROUP BY' => array( 'tl_namespace', 'tl_title' ) ),
                        'join_conds' => array ( 'page' => array ( 'LEFT JOIN',
                                        array ( 'page_namespace = tl_namespace',
                                                'page_title = tl_title' ) ) )